package test.gui;

import java.util.ArrayList;

import android.app.Activity;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.Toast;

public class guiActivity extends Activity {
    
	private ArrayAdapter adapter;
	private ArrayList<launcher> items;
	
	/** Called when the activity is first created. */
    
	@Override
    public void onCreate(Bundle savedInstanceState) {
    	
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        launcher gesture = new launcher("Gesture", "Reconnize mouvement with your rules", R.drawable.move);
        items = new ArrayList<launcher>();
        items.add(gesture);
        
        launcher draw = new launcher("Draw", "Draw on your tag matrix", R.drawable.draw);
        items.add(draw);
        
        launcher read = new launcher("Read", "Read your tag matrix", R.drawable.read);
        items.add(read);
        
        launcher init = new launcher("Initialize", "Initialize your tag matrix before use", R.drawable.clear);
        items.add(init);
        
        launcher param = new launcher("Parameters", "Manage your rules", R.drawable.hammer);
        items.add(param);
        
        launcher about = new launcher("About", "", R.drawable.about);
        items.add(about);
        
        /*
         * adapter
         */
        
        adapter=new ArrayAdapter(this, R.layout.itemview, items);
        ListView ls=(ListView) findViewById(R.id.listView1);
  
        OnItemClickListener action = new OnItemClickListener() {

			public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
					long arg3) {
				Toast.makeText(guiActivity.this,"Click on "+arg2+ " !",Toast.LENGTH_SHORT);
				Log.i("PED","Click on "+arg2+ " !");
				switch (arg2){
					case 0:	
						Toast.makeText(guiActivity.this,"Start Gesture Activity !",Toast.LENGTH_SHORT).show();
						break;
					case 1:	
						Toast.makeText(guiActivity.this,"Start Draw Activity !",Toast.LENGTH_SHORT).show();
						break;
					case 2:	
						Toast.makeText(guiActivity.this,"Start Read Activity !",Toast.LENGTH_SHORT).show();
						break;
					case 3:	
						Toast.makeText(guiActivity.this,"Start Initialize Activity !",Toast.LENGTH_SHORT).show();
						break;
					case 4:	
						Toast.makeText(guiActivity.this,"Start Parameter Activity !",Toast.LENGTH_SHORT).show();
						break;		
					case 5:	
						Toast.makeText(guiActivity.this,"Start About Activity !",Toast.LENGTH_SHORT).show();
						break;	
				}
			}
		};
		ls.setOnItemClickListener(action);
        
	      ls.setAdapter(adapter);
        /*
         * img
         */
        ImageView img = (ImageView) findViewById(R.id.imageView1);
        img.setImageResource(R.drawable.logo);
	}
}